package leistungsbewertungTRY2;

public class Starter implements Runnable {

	private int time;
	private Fields fields;
	private Thread mythread;
	private EventChain eChain;
	private Event e;
	private Schlange s ;

	public Starter(int time) {
		this.s = new Schlange();
		this.fields = new Fields();
		this.time = time;
		this.eChain = new EventChain();
		this.e = new Event();
		mythread = new Thread(this, "Clock Thread");
		mythread.start();
	}

	@Override
	public void run() {
		while (true) {
			
			try {
				Thread.sleep(00);
				time += Fields.tic;
				System.out.println(s.getQ());
				e.customerArrival(new Customer(2, 10));
				System.out.println(s.getQ());
				e.customerArrival(new Customer(5, 10));
				System.out.println(s.getQ());

			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println(time);
		}
	}

	public static void main(String[] args) {
		new Starter(0);
	}
}
